﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Menu
{
    class MouseEvent

    {
        MouseState oldButtonPress;
        MouseState buttonPress;
        Rectangle mouseDetection;

        public void update()
        {
            this.oldButtonPress = Mouse.GetState();
        }

        public MouseEvent()
        {
            this.mouseDetection = this.getMouseContainer();
        }

        public bool UpdateMouse()
        {
            buttonPress = Mouse.GetState();

            if (buttonPress.LeftButton == ButtonState.Released && this.oldButtonPress.LeftButton==ButtonState.Pressed)
            {
                return true;
            }
            return false;
        }

        public Rectangle getMouseContainer()
        {
            mouseDetection = new Rectangle((int)buttonPress.X,
                (int)buttonPress.Y,
                (int)1,
                (int)1);
            return mouseDetection;
        }
    }
}
